<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>类别添加</title>
	<script src="../../js/layui/layui.js"></script>
	<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form" onsubmit="return false;">
		<div class="layui-form-item">
			<label class="layui-form-mid">产品类别id:</label>
			<div class="layui-input-inline">
				<input type="text" name="productcat_id" placeholder="请输入产品类别id"
					autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-mid">产品类别名:</label>
			<div class="layui-input-inline">
				<input type="text" name="catname" placeholder="请输入产品类别名"
					autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
		</div>
	</form>
	<script type="text/javascript">
		var json;
		layui.use([ 'table', 'form', 'layer' ], function() {
			var table = layui.table;
			var form = layui.form;
			var layer = layui.layer;
			var $ = layui.$;

			form.on('submit(formDemo)', function(data) {
				$.post('http://localhost:8080/FiveClothes/productCat/addProType',
						data.field, function(res) {
							var msg;
							if (res) {
								msg = "添加成功";
							} else {
								msg = "添加失败";
							}
							layer.msg(msg, {
								icon : 1,
								time : 2000
							//2秒关闭（如果不配置，默认是3秒）
							}, function() {
								var index = parent.layer
										.getFrameIndex(window.name);//获取窗口索引
								parent.layer.close(index);//关闭弹出层
								window.parent.location.reload();//刷新父页面
							});
						}, 'json');
				return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
			});
		});
	</script>
</body>
</html>